package br.ufrj.dcc.manifestacoes.util;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.regex.Pattern;

import br.ufrj.dcc.manifestacoes.Manifestacao;

public class IOUtil {

	
	public static ArrayList<String> readFile(String fileName) {
		ArrayList<String> words = new ArrayList<String>();

		InputStream is = Manifestacao.class.getResourceAsStream(fileName);
		Scanner in = new Scanner(is);
		in.useDelimiter(Pattern.compile("\n"));
		String line;
		while (in.hasNext()) {
			line = in.next();
			words.add(line);
		}
		
		return words;
		
	}
	
	public static InputStream readModel(){
		String fileName = "pt-token.bin";
		InputStream is = Manifestacao.class.getResourceAsStream(fileName);
		return is;
	}
	
}
